package com.biu.billiards.controller;


import com.biu.billiards.model.vo.device.AddDeviceVo;
import com.biu.billiards.model.vo.device.GetDeviceVo;
import com.biu.billiards.model.vo.device.UpdateDeviceVO;
import com.biu.billiards.model.vo.dyVo.AddDyVo;
import com.biu.billiards.model.vo.dyVo.GetDyVo;
import com.biu.billiards.model.vo.dyVo.UpdateDyVO;
import com.biu.billiards.response.BaseResponse;
import com.biu.billiards.response.RespGenerator;
import com.biu.billiards.service.IDeviceService;
import com.biu.billiards.service.IDyService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xue
 * @since 2023-11-27
 */
@RestController
@RequestMapping()
public class DyController {


    @Resource
    private IDyService dyService;

    @ApiOperation(value = "获取抖音配置数据")
    @PostMapping("/getDyPage")
    public BaseResponse<Map<String,Object>> getDyPage(@RequestBody GetDyVo getDyVo) {
        return RespGenerator.returnOK(dyService.getDyPage(getDyVo));
    }


    @ApiOperation(value = "修改抖音配置信息")
    @PutMapping("/updateDy")
    public BaseResponse<Boolean> updateDy(@RequestBody UpdateDyVO updateDyVO) {
        return RespGenerator.returnOK(dyService.updateDy(updateDyVO));
    }


    @ApiOperation(value = "新增抖音配置信息")
    @PostMapping("/addDy")
    public BaseResponse<Boolean> addDy(@RequestBody AddDyVo addDyVo) {
        return RespGenerator.returnOK(dyService.addDy(addDyVo));
    }


    @ApiOperation(value = "删除抖音配置信息")
    @DeleteMapping("/deleteDy")
    public BaseResponse<Boolean> deleteDy(@RequestParam("dyId") Integer dyId) {
        return RespGenerator.returnOK(dyService.deleteDy(dyId));
    }



}
